﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;
using CashCommon;

namespace Cash
{
    public partial class FormReports : Form
    {
        public FormReports(DateTime dateTime)
        {
            InitializeComponent();
            _dateTime = dateTime;
        }
        
        // События
        private void FormReports_Load(object sender, EventArgs e)
        {
            Reports DataReports = new Reports();
            DataReports.Init(this._dateTime);
            this.rvReport.ProcessingMode = ProcessingMode.Local;
            this.rvReport.LocalReport.ReportPath = "Cash.rdlc";
            this.rvReport.LocalReport.DataSources.Add(new ReportDataSource("DataSetResult", DataReports.GetsResult()));
            this.rvReport.LocalReport.DataSources.Add(new ReportDataSource("DataSetCheck", DataReports.Gets()));
            this.rvReport.RefreshReport();
            if (frmProgressCancel != null)
                frmProgressCancel(null, null);
        }

        
        public static void Born(DateTime dateTime)
        {
            FormReports AppReport = new FormReports(dateTime);
            AppReport.ShowDialog();
            AppReport.Dispose();
        }

        public static event RunWorkerCompletedEventHandler frmProgressCancel;

        private DateTime _dateTime;


    }
}
